/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 */

import { Project } from '../../../../external/core/hvigor-core-node.js';
import { findSyncTaskPathsForNode } from '../../sync.js';

import { AbstractExecutePipeline } from './abstract-execute-pipeline.js';
import { TaskExecuteOptions } from './execute-mode-factory.js';

/**
 * 执行工程Project的Pipeline
 *
 * @since 2022/6/20
 */
export class ExecuteProjectPipeline extends AbstractExecutePipeline {
  constructor(project: Project, taskOptions: TaskExecuteOptions, shouldCheckTask: boolean) {
    super(project, taskOptions);
    this.shouldCheckTask = shouldCheckTask;
  }

  public findPipeAllNeedExecuteSyncTasks(): string[] {
    return findSyncTaskPathsForNode(this.project);
  }

  public findPipeAllNeedExecuteTasks(): string[] {
    return this.findAllNeedExecuteTasksForNodes([this.project]);
  }
}
